#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
using namespace std;

int a[100010] = {0};
int ai = 0, di = 0;
bool cmp(const string &a, const string &b)
{
	return a < b;
}

int main()
{
    freopen("str.in", "r", stdin);
    freopen("str.out", "w", stdout);
    int n = 0, cnt = 0;
    scanf("%d", &n);
    vector<string> strs;
    string tmpStr;
    for ( int i = 0; i < n; i++ ) {
    	cin >> tmpStr;
    	int len = tmpStr.length();
    	if ( tmpStr.find("ab") != string::npos && tmpStr[len-1] == 'x' ) {
    		cnt ++;
    		strs.push_back(tmpStr);
    	}
    }
    if ( cnt == 0 ) {
    	cout << -1 << endl;
    	return 0;
    }
    cout << cnt << endl;
    sort(strs.begin(), strs.end(), cmp);
    for ( int i = 0; i < cnt; i++ ) {
    	cout << strs[i] << endl;
    }
    return 0;
} 
